How Do Java Programs Use Inheritance? An Empirical Study of Inheritance in Java Software
نویسندگان
چکیده
Inheritance is a crucial part of object-oriented programming, but its use in practice, and the resulting large-scale inheritance structures in programs, remain poorly understood. Previous studies of inheritance have been relatively small and have generally not considered issues such as Java’s distinction between classes and interfaces, nor have they considered the use of external libraries. In this paper we present the first substantial empirical study of the large-scale use of inheritance in a contemporary OO programming language. We present a suite of structured metrics for quantifying inheritance in Java programs. We present the results of performing a corpus analysis using those metrics to over 90 applications consisting of over 100,000 separate classes and interfaces. Our analysis finds higher use of inheritance than anticipated, variation in the use of inheritance between interfaces and classes, and differences between inheritance within application types compared with inheritance from external libraries.
منابع مشابه
What Programmers Do with Inheritance in Java
Inheritance is a distinguishing feature of object-oriented programming languages, but its application in practice remains poorly understood. Programmers employ inheritance for a number of different purposes: to provide subtyping, to reuse code, to allow subclasses to customise superclasses’ behaviour, or just to categorise objects. We present an empirical study of 93 open-source Java software s...
متن کاملMultiple Code Inheritance in Java
Java has multiple inheritance of interfaces, but only single inheritance of code. This situation leads to code being duplicated in Java library classes and applications. We describe a generalization of a Java Virtual Machine (JVM) to support multiple inheritance of code. Our approach places code in interfaces, without requiring language syntax changes or compiler modifications. In our extended ...
متن کاملWorking with Java Interfaces and Classes How to maximize design and code reuse in the face of inheritance
Software engineering has been using interfaces for over 25 years. The distinction between interfaces and implementations is an important issue of object-oriented software system design. Java supports this distinction, yet for many developers, in particular with a C++ or Smalltalk background, the proper use of interfaces may not be intuitive right from the beginning. This article briefly discuss...
متن کاملExpressive Modular Linking for Object-Oriented Languages
In this paper we show how modular linking of program fragments can be added to statically typed, object-oriented (OO) languages. Programs are being assembled out of separately developed software components deployed in binary form. Unfortunately, mainstream OO languages (such as Java) still do not provide support for true modular linking. Modular linking means that program fragments can be separ...
متن کاملChoosing Efficient Inheritance Patterns for Java Generics
Java generic types allow a programmer to create parameterized data structures and methods. For instance, a generic Stack type may be used for integers in one instance and for strings in another. Java compiler guarantees in this case that integers and strings are not mixed in the same stack. We study runtime efficiency of a certain inheritance pattern related to Java generic types: narrowing of ...
متن کامل